package com.szrt.java.day20170113.demo06;

/**
 *  装饰者模式
 *  组合：在一个类有另外一个类 解决单继承问题
 * @author zsrt
 *
 */

public class SwimCar {

	private CommonCar car;
	
	public SwimCar() {
		
	}
	public SwimCar(CommonCar car) {
		this.car = car;
	}

	public void drive(){
		//1 可以在陆地上开
		car.drive();
		//2 可以在水中游
		swim();
	}

	

	public void swim(){
		System.out.println("在水中游泳...");
	}
	
}
